package com.RWM.helpers;

import org.json.JSONArray;
import org.json.JSONException;

import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Toast;

public class CustomOnItemSelectedListener implements OnItemSelectedListener {
	private JSONArray driverlist = null; 
	public String phone;
	public CustomOnItemSelectedListener(JSONArray d){
		this.driverlist = d;
	}
	  public void onItemSelected(AdapterView<?> parent, View view, int pos,long id) {
	
		try {
			setPhone(driverlist.getJSONObject((int)id).getString("phone"));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	  }
	 
	  public void onNothingSelected(AdapterView<?> arg0) {
		// TODO Auto-generated method stub
	  }

	  public void setPhone(String num){
		  this.phone = num;
	  }
	  
	  public String getPhone(){
		  return this.phone;
	  }
	 
	}
